﻿// -----------------------------------------------------------------------
// <copyright file="IFileSystemInfo.cs" company="Company">
// Company 2011
// </copyright>
// -----------------------------------------------------------------------

using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;

namespace Company.IO.Interfaces
{
    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    [Guid("fe033c9c-bb7a-4627-914d-7f735f14c5a8")]
    public interface IFileSystemInfo : ISerializable
    {
        /// <summary>
        /// Gets the full path of the directory or file.
        /// </summary>
        /// <exception cref="IPathTooLongException">
        /// <para>
        /// The fully qualified path and file name is 260 or more characters.
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission. 
        /// </para>
        /// </exception>
        /// <value>
        /// <para>
        /// A string containing the full path.
        /// </para>
        /// </value>
        string FullName { [SecuritySafeCritical]
        get; }

        /// <summary>
        /// Gets the string representing the extension part of the file.
        /// </summary>
        /// <value>
        /// <para>
        /// The Extension property returns the FileSystemInfo extension, including the period (.). 
        /// For example, for a file c:\NewFile.txt, this property returns ".txt".
        /// </para>
        /// </value>
        string Extension { get; }

        /// <summary>
        /// For files, gets the name of the file. 
        /// For directories, gets the name of the last directory in the hierarchy if a hierarchy exists. 
        /// Otherwise, the Name property gets the name of the directory.
        /// </summary>
        /// <value>
        /// <para>
        /// A string that is the name of the parent directory, 
        /// the name of the last directory in the hierarchy, 
        /// or the name of a file, including the file name extension.
        /// </para>
        /// </value>
        string Name { get; }

        /// <summary>
        /// Gets a value indicating whether the file or directory exists.
        /// </summary>
        /// <value>
        /// <para>
        /// true if the file or directory exists; otherwise, false.
        /// </para>
        /// </value>
        bool Exists { get; }

        /// <summary>
        /// Gets or sets the creation time of the current file or directory.
        /// </summary>
        /// <exception cref="PlatformNotSupportedException">
        /// <para>
        /// The current operating system is not Windows NT or later. 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The specified path is invalid; for example, it is on an unmapped drive.  
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <para>
        /// The caller attempts to set an invalid creation time. 
        /// </para>
        /// </exception>
        /// <exception cref="IIOException">
        /// <para>
        /// Refresh cannot initialize the data. 
        /// </para>
        /// </exception>
        /// <value>
        /// <para>
        /// The creation date and time of the current FileSystemInfo object.
        /// </para>
        /// </value>
        DateTime CreationTime { [SecuritySafeCritical]
        get; set; }

        /// <summary>
        /// Gets or sets the creation time, in coordinated universal time (UTC), of the current file or directory.
        /// </summary>
        /// <exception cref="PlatformNotSupportedException">
        /// <para>
        /// The current operating system is not Windows NT or later. 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The specified path is invalid; for example, it is on an unmapped drive.  
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <para>
        /// The caller attempts to set an invalid creation time. 
        /// </para>
        /// </exception>
        /// <exception cref="IIOException">
        /// <para>
        /// Refresh cannot initialize the data. 
        /// </para>
        /// </exception>
        /// <value>
        /// <para>
        /// The creation date and time in UTC format of the current FileSystemInfo object.
        /// </para>
        /// </value>
        [ComVisible(false)]
        DateTime CreationTimeUtc { [SecuritySafeCritical]
        get; set; }

        /// <summary>
        /// Gets or sets the time the current file or directory was last accessed.
        /// </summary>
        /// <exception cref="PlatformNotSupportedException">
        /// <para>
        /// The current operating system is not Windows NT or later. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <para>
        /// The caller attempts to set an invalid creation time. 
        /// </para>
        /// </exception>
        /// <exception cref="IIOException">
        /// <para>
        /// Refresh cannot initialize the data. 
        /// </para>
        /// </exception>
        /// <value>
        /// <para>
        /// The time that the current file or directory was last accessed.
        /// </para>
        /// </value>
        DateTime LastAccessTime { [SecuritySafeCritical]
        get; set; }

        /// <summary>
        /// Gets or sets the time, in coordinated universal time (UTC), that the current file or directory was last accessed.
        /// </summary>
        /// <exception cref="PlatformNotSupportedException">
        /// <para>
        /// The current operating system is not Windows NT or later. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <para>
        /// The caller attempts to set an invalid creation time. 
        /// </para>
        /// </exception>
        /// <exception cref="IIOException">
        /// <para>
        /// Refresh cannot initialize the data. 
        /// </para>
        /// </exception>
        /// <value>
        /// <para>
        /// The UTC time that the current file or directory was last accessed.
        /// </para>
        /// </value>
        [ComVisible(false)]
        DateTime LastAccessTimeUtc { [SecuritySafeCritical]
        get; set; }

        /// <summary>
        /// Gets or sets the time when the current file or directory was last written to.
        /// </summary>
        /// <exception cref="PlatformNotSupportedException">
        /// <para>
        /// The current operating system is not Windows NT or later. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <para>
        /// The caller attempts to set an invalid creation time. 
        /// </para>
        /// </exception>
        /// <exception cref="IIOException">
        /// <para>
        /// Refresh cannot initialize the data. 
        /// </para>
        /// </exception>
        /// <value>
        /// <para>
        /// The time the current file was last written.
        /// </para>
        /// </value>
        DateTime LastWriteTime { [SecuritySafeCritical]
        get; set; }

        /// <summary>
        /// Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to.
        /// </summary>
        /// <exception cref="PlatformNotSupportedException">
        /// <para>
        /// The current operating system is not Windows NT or later. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <para>
        /// The caller attempts to set an invalid creation time. 
        /// </para>
        /// </exception>
        /// <exception cref="IIOException">
        /// <para>
        /// Refresh cannot initialize the data. 
        /// </para>
        /// </exception>
        /// <value>
        /// <para>
        /// The UTC time when the current file was last written to.
        /// </para>
        /// </value>
        [ComVisible(false)]
        DateTime LastWriteTimeUtc { [SecuritySafeCritical]
        get; set; }

        /// <summary>
        /// Gets or sets the attributes for the current file or directory.
        /// </summary>
        /// <exception cref="IFileNotFoundException">
        /// <para>
        /// The specified file does not exist. 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The specified path is invalid; for example, it is on an unmapped drive.  
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <para>
        /// The caller attempts to set an invalid file attribute. 
        /// </para>
        /// </exception>
        /// <exception cref="IIOException">
        /// <para>
        /// Refresh cannot initialize the data. 
        /// </para>
        /// </exception>
        /// <value>
        /// <para>
        /// FileAttributes of the current FileSystemInfo.
        /// </para>
        /// </value>
        FileAttributes Attributes { [SecuritySafeCritical]
        get; [SecuritySafeCritical]
        set; }

        /// <summary>
        /// Deletes a file or directory.
        /// </summary>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The specified path is invalid; for example, it is on an unmapped drive. 
        /// </para>
        /// </exception>
        /// <exception cref="IIOException">
        /// <para>
        /// There is an open handle on the file or directory, and the operating system is Windows XP or earlier. 
        /// This open handle can result from enumerating directories and files. 
        /// For more information, see How to: Enumerate Directories and Files. 
        /// </para>
        /// </exception>
        void Delete();

        /// <summary>
        /// Refreshes the state of the object.
        /// </summary>
        /// <exception cref="IIOException">
        /// <para>
        /// A device such as a disk drive is not ready.
        /// </para>
        /// </exception>
        [SecuritySafeCritical]
        void Refresh();
    }
}